﻿using RecruitStudents.Utility;
using RecruitStudents.Utility.Json;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RecruitStudents.Client.BLL
{
    public class ServiceScore
    {
        WS_Score.ScoreService scoreService = new WS_Score.ScoreService();
        WS_Score.MySoapHeader objHeader = new WS_Score.MySoapHeader();
        internal ServiceScore()
        {
            objHeader.Username = "admin";
            objHeader.Password = "xy";
            scoreService.MySoapHeaderValue = objHeader;
        }
        public DataTable GetScoreQueryUp(string strSFYSB, string strExamRoomID, string strTeacherID, string strExaminationID,
            string strExamPlaceID, string strSpecialityKindsNO, string strExamLevel)
        {
            return scoreService.GetScoreQueryUp(strSFYSB,strExamRoomID, strTeacherID, strExaminationID, 
                strExamPlaceID, strSpecialityKindsNO, strExamLevel).ToDataTable();
        }
        public DataTable GetScoreQuery(string strSFYSB, string strExamRoomID, string strTeacherID, string strExaminationID,
            string strExamPlaceID, string strSpecialityKindsNO, string strExamLevel)
        {
            return scoreService.GetScoreQuery(strSFYSB, strExamRoomID, strTeacherID, strExaminationID, strExamPlaceID, strSpecialityKindsNO, strExamLevel).ToDataTable();
        }

        public DataTable GetTeacherScoreList(string strAllowExamID, string strExaminationID, string strSpecialityKindsNO, string strExamLevel)
        {
            return scoreService.GetTeacherScoreList(strAllowExamID, strExaminationID, strSpecialityKindsNO, strExamLevel).ToDataTable();
        }

        public string SaveUpData(string strAllowExamID, string strSpecialityKindsNO, string strExamLevel, string strExamPlaceID, string strIsPass)
        {
            try
            {
                JsonMessage message = scoreService.SaveUpData(strAllowExamID, strSpecialityKindsNO,
                    strExamLevel, strExamPlaceID, strIsPass).ToList<JsonMessage>();
                if (message.State == "true")
                {
                    return string.Empty;
                }
                return message.Msg;
            }
            catch (Exception ex)
            {
                return ex.Message;
            }

        }

        public string SavePublishData(string strAllowExamID, string strSpecialityKindsNO, string strExamLevel, string strExamPlaceID, string strIsPass,
            string strRemark, string strIsInOut)
        {
            try
            {
                JsonMessage message = scoreService.SavePublishData(strAllowExamID, strSpecialityKindsNO, strExamLevel, strExamPlaceID, strIsPass, strRemark, strIsInOut).ToList<JsonMessage>();
                if (message.State == "true")
                {
                    return string.Empty;
                }
                return message.Msg;
            }
            catch (Exception ex)
            {
                return ex.Message;
            }
        }

        public DataTable GetExamResultsPublishTable(string strExamPlaceNO, string strSpecialityKindsNO, string strExamLevel)
        {
            return scoreService.GetExamResultsPublishTable(strExamPlaceNO, strSpecialityKindsNO, strExamLevel).ToDataTable();
        }
    }
}
